package Service;

import Dao.TaobaoDao;
import domain.Taobao;

import java.sql.SQLException;
import java.util.List;

public class TaobaoService {
    TaobaoDao taobaoDao=new TaobaoDao();

    /*查询所有产品信息*/
    public List<Taobao> findAll(List list) throws SQLException {
        String sql ="select * from tb where 1=1";
        return taobaoDao.findAll(sql,list);
    }

    /*新增信息*/
    public int xz(List list) throws SQLException {
        String sql="INSERT INTO tb (s_name, s_ms,s_time,s_price) VALUES (?,?,?,?)";
        return taobaoDao.xz(sql,list);
    }


    /*修改信息*/
    public int update( List list){
        String sql ="update tb set s_name=?,s_ms=?,s_time=?,s_price=? where s_id=?";
        return taobaoDao.update(sql,list);

    }


    /*删除*/

    public int delete(List list){
        String sql ="delete from tb where s_id=?";
        return taobaoDao.delete(sql,list);
    }

    /*详情*/
    public List<Taobao> xq(List list) throws SQLException {
        String sql ="select * from tb where s_id=?";
        return taobaoDao.findAll(sql,list);
    }

    /*模糊查询*/
    public  List<Taobao> mohu(String stu) throws SQLException {
        String sql ="select * from tb where  s_name like ?";
        return taobaoDao.mhcx(sql,stu);
    }




}
